package vista;

import java.util.ArrayList;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;
import javax.swing.table.AbstractTableModel;

import modelo.Liga;
import modelo.Partido;

/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class VentanaCalendarioTabla extends AbstractTableModel {

	private static String[] titulos = {" Codigo ", " Fecha", " Homeclub "," Marcador "," Visitante ", " Innings ", " Umpire "};
	
	private ArrayList<Partido> partidos;
	
	public VentanaCalendarioTabla(ArrayList<Partido> partido) {
		super();
		this.partidos = partido;
	}

	@Override
	public int getColumnCount() {
		return titulos.length;
	}

	@Override
	public int getRowCount() {
		return partidos.size();
	}
	@Override
	public Object getValueAt(int rowIndex, int columnIndex) {
		Partido partido = partidos.get(rowIndex);
		switch (columnIndex){
			case 0: return partido.getCodigo();
			case 1: return partido.getFechaPartido();
			case 2: return partido.getEquipoCasa();
			case 3: return partido.getMarcFinalCasa() + " - " + partido.getMarcFinalVisit();
			case 4: return partido.getEquipoVisit();
			case 5: return partido.getInnings();
			case 6: return partido.getUmpire();
			
		}
		return null;
	}

	@Override
	public String getColumnName(int column) {
		return titulos[column];
	}


}
